package org.example.tree;

/**
 * @author liyishan
 * @date 2024/6/14 09:55
 * @apiNote
 */

public class Test00700SearchBST {

    public TreeNode searchBST(TreeNode root, int val) {
        if (root == null){
            return null;
        }
        if(root.val == val){
            return root;
        }
        return searchBST(val < root.val ? root.left : root.right,val);
    }
}
